package sca.com.cy.config;


import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
/*
* 定义请求解析器,用于对请求进行解析,并返回解析结果,sentinel底层
* 在拦截到用户请求以后,会对请求数据基于此对象进行解析,判定是否符合黑白名单规则
* */
@Component
public class DefaultRequestOriginParser implements RequestOriginParser {

    @Override
    public String parseOrigin(HttpServletRequest request) {
        return request.getParameter("name");
    }
}
